﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Inspector;component/UserInterface/VisualResources/Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>


    <Style  TargetType="{x:Type TabControl}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="row0" Height="Auto"/>
                            <RowDefinition x:Name="row1" Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Name="Border"  Grid.Row="1"  Background="{DynamicResource DefaultBackgroundBrush}"
                                BorderBrush="#eee"  BorderThickness="1"  KeyboardNavigation.TabNavigation="Local"
                                KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" >
                            <ContentPresenter Name="PART_SelectedContentHost" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ContentSource="SelectedContent" />
                        </Border>
                        <TabPanel Name="HeaderPanel" Margin="0,0,4,-1" IsItemsHost="True" KeyboardNavigation.TabIndex="1" 
                                  Background="Transparent" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter TargetName="row0" Property="Height" Value="*" />
                            <Setter TargetName="row1" Property="Height" Value="Auto" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
                            <Setter TargetName="Border" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Margin" Value="0,-1,4,0" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="TabItem">
        <Setter Property="Foreground" Value="{DynamicResource DefaultForegroundBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment"  Value="Stretch" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabItem">
                    <Grid ClipToBounds="False">
                        <Border Name="Border" Background="{DynamicResource ButtonHoverBackgroundBrush}" BorderBrush="{DynamicResource DefaultBorderBrush}" Margin="0,0,-1,0" BorderThickness="1,1,1,1" CornerRadius="2" >
                        </Border>
                        <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="8,3"/>
                        <Rectangle x:Name="leftShadow" VerticalAlignment="Stretch" HorizontalAlignment="Left" Margin="0,0,0,0" Width="6" >
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                    <GradientStop Color="#55000000" Offset="0" />
                                    <GradientStop Color="#00000000" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}" >
                            <Setter TargetName="leftShadow" Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource DefaultBackgroundBrush}" />
                            <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                            <Setter TargetName="leftShadow" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True" />
                                <Condition Property="TabItem.TabStripPlacement" Value="Bottom" />
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderThickness" TargetName="Border" Value="1,0,1,1"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>